<template>
  <div class="charts" ref="charts"></div>
</template>

<script>
import echarts from "echarts";

export default {
  props: {},
  name: "",
  data() {
    return {};
  },
  computed: {},
  created() {},
  mounted() {
    //   初始化echarts实例
    let myChart = echarts.init(this.$ref.charts);
    myChart.setOption({
      xAxis: {
        show: false,
        // 设置x轴的最大最小值
        min: 0,
        max: 100,
      },
      yAxis: {
        show: false,
        // 在y轴上均分可以让柱状图横着排列
        type: "category",
      },
      series: [
        {
          type: "bar",
          data: [78],
          color: "cyan",
          barWidth: 10,
          showBackground: true,
          //   背景颜色
          backgroundStyle: {
            color: "rgba(180, 180, 180, 0.2)",
          },
          label: {
            show: true,
            // 图上面显示的内容
            formatter: "|",
            // 图文本内容位置的调试
            position: "right",
          },
        },
      ],
      tooltips: {},
      grid: {
        left: 0,
        top: 0,
        bottom: 0,
        right: 0,
      },
    });
  },
  watch: {},
  methods: {},
  components: {},
};
</script>

<style scoped lang="scss">
.charts {
  width: 100%;
  height: 100%;
}
</style>
